home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
program
/
vol15n10.zip
/
WHATIS.ZIP
/
WHATISIT.SCR
< prev
Wrap
Text File
|
1995-12-26
|
5KB
|
107 lines
n WHATISIT.COM
a 100
XOR CX,CX ; CX = 0
MOV SI,0080 ; SI -> command line storage in PSP.
MOV CL,[SI] ; CX = length of command line.
INC SI ;0107 (Start of scan loop)
CMP BYTE PTR [SI],20 ; Space?
JZ 0112 ; Skip if so.
CMP BYTE PTR [SI],09 ; Tab?
JNZ 0117 ; Skip if not
LOOP 0107 ;0112 Loop back to SCAN1
JMP 01CE ; Error if command line empty.
MOV DX,SI ; Save start of parm.
INC SI ;0119 (Second scan loop)
CMP BYTE PTR [SI],20 ; Space?
JZ 0130 ; Skip if so.
CMP BYTE PTR [SI],09 ; Tab?
JZ 0130 ; Skip if so.
CMP BYTE PTR [SI],0A ; Line feed?
JZ 0130 ; Skip if so.
CMP BYTE PTR [SI],0D ; Carriage return?
JZ 0130 ; Skip if so.
LOOP 0119 ; Loop back to SCAN2.
MOV BYTE PTR [SI],00 ;0130 Terminate with NULL
MOV SI,0204 ; SI -> buffer
MOV AX,3D80 ; DOS File Open function.
INT 21
JNB 0140 ; Skip if succesful.
JMP 01C2 ; Error if not.
MOV BX,AX ;0140 BX = file handle.
XOR CX,CX ; CX:DX = 0000:003Ch
MOV DX,003C ; (Pointer to Windows header)
CALL 01A3 ; Seek
MOV CX,0002 ; Read WORD from file.
CALL 01AB
MOV DX,[SI] ; DX = offset to Windows header
MOV DI,DX ; Save offset in DI
XOR CX,CX ; CX = 0
CALL 01A3 ; Seek to Windows header.
MOV CX,0002 ; Read two bytes.
CALL 01AB
CMP WORD PTR [SI],454E ; Should be "NE",
JNZ 01B5 ; otherwise not a Win executable.
MOV DX,002C ; Seek to offset 2CH from
ADD DX,DI ; start of Windows header.
XOR CX,CX
CALL 01A3
MOV CX,0004 ; Read DWORD from file (pointer to
CALL 01AB ; non-resident name table)
MOV DX,[SI] ; CX:DX = offset.
MOV CX,[SI+02]
CALL 01A3 ; Seek to non-resident name table.
MOV CX,0001 ; Read 1 byte (length of first string)
CALL 01AB
XOR CH,CH ; CX = length of string.
MOV CL,[SI]
OR CL,CL ; Is string NULL?
JZ 01BC ; Done if so.
CALL 01AB ; Read string.
MOV CX,AX ; CX = # of bytes read.
MOV AH,02 ; Function 02H = console output.
CLD ; String instructions forward.
LODSB ;0193 Read character.
MOV DL,AL ; DL = character.
INT 21 ; Display it.
LOOP 0193 ; Loop for rest of string.
MOV AH,09
MOV DX,0201 ; Point to CR/LF.
INT 21 ; Display it.
JMP 01BC ; Close file and return to DOS.
MOV AX,4200 ;01A3 (Subroutine) Seek from beginning of file.
INT 21 ; Call DOS.
JB 01B4 ; Report error if seek failed.
RET ; Back to caller if successful.
MOV AH,3F ;01AB (Subroutine) Read CX bytes from file
MOV DX,SI ; DX -> buffer
INT 21 ; Call DOS.
JB 01B4 ; Skip if read failed.
RET ; Back to caller if successful.
POP AX ;01B4 Clear return address from stack.
MOV DX,01E3 ; DX -> error message.
MOV AH,09 ; Display string.
INT 21
MOV AH,3E ;01BC Close file.
INT 21
JMP 01CE ; All Done.
MOV DX,01D3 ;01C2 DX -> "File not found."
MOV AH,09 ; Display it.
INT 21
MOV DX,0201 ; DX -> CR/LF
INT 21 ; Display it.
MOV AX,4C00 ;01CE Set ERRORLEVEL to 0.
INT 21 ; Back to DOS.
;Should be offset 01D3
DB 'File not found.$'
;Should be offset 01E3
DB 'Not a Win 3.x executable file.'
;Should be offset 0201
DB 0D 0A 24
;Should be offset 0204 (start of buffer)
rcx
104
w
q